package me.keiwu.log.service.impl;

import me.keiwu.log.dao.LogErrorDao;
import me.keiwu.log.domain.LogError;
import me.keiwu.log.service.LogErrorService;
import me.keiwu.pub.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by kei on 29/12/2017.
 */
@Service
public class LogErrorServiceImpl implements LogErrorService {


    @Autowired
    private LogErrorDao logErrorDao;


    @Override
    public void logError(String requestUri, String localIp, String className, String func, String message) {
        LogError error = new LogError();
        error.setRequestUri(requestUri);
        error.setLocalIp(localIp);
        error.setClassName(className);
        error.setFunction(func);
        error.setLogTime(DateUtil.getUnixTime());
        error.setMessage(message);
        logErrorDao.save(error);
    }


}
